﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ToDoList.Logic
{
    public class Initialize
    {
        public static List<User> UserList = new List<User>();
        public static List<Inventory> InventoryList = new List<Inventory>();
        public static List<Item> ItemList = new List<Item>();

        public Initialize()
        {
            //初始化用户
            var user = new User
            {
                Name = "小云",
                NikeName = "zhang",
                Password = "123456",
                UserId =1 
            };
            //初始化清单
            var inventory = new Inventory
            {
                CreatName = "小云",
                CreatTime = DateTime.Now.ToLocalTime().ToString(),
                InventoryId = 1,               
                ListName = "玩"
            };
            //初始化事项
            List<Item> item = new List<Item>()
            {
                new Item
                {
                    CreatTime = DateTime.Now.ToLocalTime().ToString(),
                    Content = "吃早饭",
                    ItemId = 1,
                    UserID=user.UserId,
                    State = true,
                    TimeOfExpiration = DateTime.Parse("2017/7/28 16:50:30"),
                    Mark = "叫上小伙伴"
                },
                new Item
                {
                    CreatTime = DateTime.Now.ToLocalTime().ToString(),
                    Content = "做早操",
                    ItemId = 2,
                    UserID=user.UserId,
                    State = false,
                    TimeOfExpiration = DateTime.Parse("2017/7/23 8:50:30"),
                    Mark = ""
                },
            };
    
            //添加事项到清单
            inventory.ItemListOfInventory = new List<Item>();
            inventory.ItemListOfInventory.AddRange(item);

            //添加清单到用户
            user.UserInventoryList = new List<Inventory>();
            user.UserInventoryList.Add(inventory);
            inventory.User = user;

            //添加事项到用户
            user.UserItemList = new List<Item>();
            user.UserItemList.AddRange(item);            

            //汇入总数据
            UserList.Add(user);
            InventoryList.Add(inventory);
            ItemList.AddRange(item);
        }
    }
}
